From: Keir Fraser Date: Fri, 21 Jan 2011 15:58:27 +0000 (+0000) Subject: x86:x2apic: Disable x2apic on x86-32 permanently X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10896^2~2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=4b00b9efae1190d759e1f4e01e1af2e3767b575c;p=xen.git x86:x2apic: Disable x2apic on x86-32 permanently x2apic initialization on x86_32 uses vcpu pointer before it is initialized. As x2apic is unlikely to be used on x86_32, this patch disables x2apic permanently on x86_32. It also asserts the sanity of vcpu pointer before dereference to prevent further misuse. Signed-off-by: Fengzhe Zhang --- diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 1590c3a171..ceefc6784d 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -961,6 +961,22 @@ void __init x2apic_bsp_setup(void) if ( !cpu_has_x2apic ) return; +#ifdef __i386__ + clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability); + if ( x2apic_enabled ) + { + uint64_t msr_content; + rdmsrl(MSR_IA32_APICBASE, msr_content); + msr_content &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD); + wrmsrl(MSR_IA32_APICBASE, msr_content); + msr_content |= MSR_IA32_APICBASE_ENABLE; + wrmsrl(MSR_IA32_APICBASE, msr_content); + x2apic_enabled = 0; + } + printk("x2APIC disabled permanently on x86_32.\n"); + return; +#endif + if ( !opt_x2apic ) { if ( !x2apic_enabled )